package com.tj.template.application.enums;

import com.fqgj.exception.enums.ErrorCodeEnum;
import org.springframework.http.HttpStatus;

/**
 * @program: binary-option
 * @description
 * @author: binary
 * @create: 2020-06-11 11:32
 **/
public enum OrderRestErrorEnum implements ErrorCodeEnum {


    ORDERS_QUANTITY_LIMIT(30001, "Maximum number of open positions are %s.", HttpStatus.OK),
    ORDERS_AMOUNT_UPPER(30002, "Amount cannot exceed %s.", HttpStatus.OK),
    ORDERS_AMOUNT_LOWER(30003, "Amount cannot be less than %s.", HttpStatus.OK),
    ORDERS_PRODUCT_NOT_EXIST(30004, "Current product does not exist.", HttpStatus.OK),
    ORDERS_PRODUCT_INVALID(30005, "This product is not in the opening time, please select another product.", HttpStatus.OK),
    ORDERS_FREQUENCY_TOO_FAST(30006, "Click frequency is too fast, please click slowly.", HttpStatus.OK),
    ORDERS_PRICE_NOT_EXIST(30007, "Unable to get the order price, please try again later.", HttpStatus.OK),
    ORDERS_DELAY_TOO_HIGH(30008, "The current network delay is too high. Please refresh and try again.", HttpStatus.OK),
    ORDERS_PRODUCT_LOCKED(30009, "Current product is not available, please choose other product.", HttpStatus.OK),
    BLACK_USER_TIPS(30010, "Due to security reasons, your account temporarily can't be used, please contact customer service.", HttpStatus.OK),
    ;

    OrderRestErrorEnum(Integer code, String desc, HttpStatus httpStatus) {
        this.code = code;
        this.desc = desc;
        this.httpStatus = httpStatus;
    }

    private Integer code;
    private String desc;
    private HttpStatus httpStatus;

    public OrderRestErrorEnum setCode(Integer code) {
        this.code = code;
        return this;
    }

    public String getDesc() {
        return desc;
    }

    public OrderRestErrorEnum setDesc(String desc) {
        this.desc = desc;
        return this;
    }

    public OrderRestErrorEnum setHttpStatus(HttpStatus httpStatus) {
        this.httpStatus = httpStatus;
        return this;
    }

    @Override
    public HttpStatus getHttpStatus() {
        return httpStatus;
    }

    @Override
    public Integer getCode() {
        return code;
    }

    @Override
    public String getMsg() {
        return desc;
    }
}
